<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修饰符</title>
</head>
<body>
<div id="app">
  <p>t1.
    <!-- stop === stopPropagation,cancelBubble=true; -->
    <div @click="parent">parent
        <div @click="child">child
            <div @click.stop="grandson">grandson</div>
        </div>
    </div>
  </p>
  <p>t2. 捕获  xxx.addEventListener('click',fn,true)
    <!-- 捕获  xxx.addEventListener('click',fn,true) -->
    <div @click.capture="parent">parent
      <div @click.capture="child">child
        <div @click="grandson">grandson</div>
      </div>
    </div>
  </p>
  <p>t3. preventDefault,returnValue=false<br/>
      <a href="http://www.baidu.com" @click.prevent="parent">去百度</a>
  </p>

  <p>t4. once 只运行一次 on('click') off('click')
    <!-- stopPropagation 组织事件传播  on('click') off('click') -->
  <div @click="parent">parent
    <div @click.once="child">child
      <div @click="grandson">grandson</div>
    </div>
  </div>
  </p>

  <p>t5. 判断事件源 e.srcElement&&e.target 判断事件源绑定事件
    <!-- stopPropagation 组织事件传播  on('click') off('click') -->
  <div @click="parent">parent
    <div @click.self="child">child
      <div @click="grandson">grandson</div>
    </div>
  </div>
  </p>
</div>

</body>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
   let vm =  new Vue({
        el: '#app',
        methods:{
          parent(){
            alert('parent');
          },
          child(){
            alert('child');
          },
          grandson(){
            alert('grandson');
          }
        },
        data:{
           a:true,
          b:['爬山']
        }
    })

</script>
</html>
